import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Button',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyStatelessWidget(),
    );
  }
}

class MyStatelessWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //定义文本样式

    return Scaffold(
      appBar: AppBar(
        title: Text("Button"),
      ),
      body: Column(
        children: <Widget>[
          //悬浮按钮，具有悬浮特效,带阴影
          RaisedButton(
            child: Text("RaisedButton"),
            onPressed: ()=>{
              print("RaisedButtonPressd")
            },
          ),
          //按钮，不带阴影
          FlatButton(
            child: Text("FlatButton"),
            onPressed: ()=>{
              print("FlatButtonPressd")
            },
          ),
          //按钮，带外边框
          OutlineButton(
            child: Text("OutlineButton"),
            onPressed: ()=>{
              print("OutlineButtonPressd")
            },
          ),
          //自定义按钮
          FlatButton(
            child: Text("自定义Button"),
            //button字体颜色
            textColor: Colors.red,
            //背景色
            color: Colors.blue,
            //button按下后背景颜色
            highlightColor: Colors.yellow,
            //圆角
            shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(20.0) ),
            onPressed: ()=>{
              print("自定义ButtonPressed")
            },
          ),
        ],
      ),
    );
  }

}
